package org.cloudnote.controller.note;

import org.cloudnote.entity.Note;
import org.cloudnote.service.NoteService;
import org.cloudnote.util.NoteResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("note")
public class NoteController {

    @Autowired
    private NoteService noteService;

    @RequestMapping("loadnotes.do")
    @ResponseBody
    public NoteResult loadNotes(String bookId){
        NoteResult result = noteService.loadBookNotes(bookId);
        return result;
    }
    @ResponseBody
    @RequestMapping("/load.do")
    public NoteResult loadNoteDetail(String id){
        NoteResult result = noteService.loadNoteDetail(id);
        return result;
    }
    @RequestMapping("/add.do")
    @ResponseBody
    public NoteResult addNote(String bookId,String noteTitle,String userId){
        NoteResult noteResult = noteService.addNote(bookId,noteTitle,userId);
        return noteResult;
    }
}
